<?php global $ubi;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>TÙM LUM site</title>
        
		<link href="include/css/style.css" media="screen" rel="stylesheet" type="text/css" />
		<link href="include/css/styles.css" type="text/css" media="all" rel="stylesheet" id="contact-form-7-css" />
        <link href="include/css/site.css" media="screen" type="text/css" rel="stylesheet" />
		<link href="include/css/jquery-ui.css" type="text/css" rel="stylesheet" />
		
		<script language="javascript" src="include/script/jquery-1.4.4.min.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript" src="include/script/jquery-ui-1.8.14.custom.min.js"></script>
		<script language="javascript" type="text/javascript" src="include/script/script.js"></script>
		
		<script type="text/javascript" language="javascript">
			$.extend({
				showProviderForm:function(show) {
					if (show === true) {
						$('form[name=searchProvider]').show();
						$('form[name=searchItem]').hide();
					} else {
						$('form[name=searchProvider]').hide();
						$('form[name=searchItem]').show();
					}
				}	
			});
			
			$(document).ready(function(){
				$('#randomItemProvider').load('index.php?load&view=randomItemProvider');
				$('#blockSignIn').load('index.php?load&view=blockSignIn');
				$('#blockSearch').load('index.php?load&view=blockSearch');
				$('#blockMembers').load('index.php?load&view=blockMembers');
				$('#blockNewestPosts').load('index.php?load&view=blockNewestPosts');
				$('#mainMenu').load('index.php?load&view=menu');
				$('#footer').load('index.php?load&view=footer');

				$('#selCity').change(function() {
					$.postToGetListLocation(this, $('#selDistrict'), true, '<?php echo isset($district)?$district:''?>');	
				});

				$('#selDistrict').change(function() {
					$.postToGetListLocation(this, $('#selWard'), true, '<?php echo isset($ward)?$ward:''?>');	
				});

				$('form[name=searchProvider] input[name=txtNumber]').val('<?php echo isset($number)?$number:''?>');
				$('form[name=searchProvider] input[name=txtStreet]').val('<?php echo isset($street)?$street:''?>');
				$('form[name=searchProvider] input[name=txtProvider]').val('<?php echo isset($providerName)?$providerName:''?>');

				$('form[name=searchItem] input[name=txtItemName]').val('<?php echo isset($itemName)?$itemName:''?>');
				$('form[name=searchItem] input[name=txtBeginPrice]').val('<?php echo isset($beginPrice)?$beginPrice:''?>');
				$('form[name=searchItem] input[name=txtEndPrice]').val('<?php echo isset($endPrice)?$endPrice:''?>');
				$('form[name=searchItem] input[name=txtUnit]').val('<?php echo isset($unit)?$unit:''?>');

				$('form[name=searchItem]').hide();
				
				$('#selCat').change(function() {
					var val = $(this).val();
					$.showProviderForm(val === 'provider');
				});
				
				$('#selCat').val('provider');

				<?php
					if (isset($getVars['cat']) && $getVars['cat'] != '') {
				?>		
						$('#selCat').val('<?php echo $getVars['cat']?>');
						$.showProviderForm('<?php echo $getVars['cat']?>' === 'provider');
				<?php						
					}
				?>
				$.loadListLocation($('#selCity'), 0, false, '<?php echo isset($city)?$city:''?>');
			});				
		</script>
	</head>
    
    <body>
		<div id="corners">			
			<div class="header" id="main-head">
				<div id="hdr-info">
                	<div style="float:left">
                        <img id="logo" src="include/imgs/logo4.png" alt="Tùm Lum site" width="235px" />
                        <p id="desc">Tùm Lum, Tả Pí Lù, chia sẻ tất cả ở đây</p>
                    </div>
                    <div class="nav">
                        <div id="mainMenu"></div>
                        <div style="clear:both"></div>
                    </div>
				</div>              
			</div> <!--end header-->
            
			<div class="polaroids">
            	<div class="marginBoxPicCollection" id="randomItemProvider"></div>
			</div> <!--end polaris-->
            
            <div id="container">
				<div class="left">
                    <div class="section" id="content">
                    	Chọn loại : 
                    	<select id="selCat">
                    		<option selected="selected" value="provider">Địa điểm</option>
                    		<option value="item">Hàng hóa</option>
                    	</select>
                    	<br /><br />
                    	<form name="searchProvider" action="index.php?view&type=advancedSearch&cat=provider" method="post">
							<ul class="frm">
								<li>
									<label>Chọn thành phố</label> 
									<select name="selCity" id="selCity"></select>
								</li>
								<li>
									<label>Chọn quận</label> 
									<select name="selDistrict" id="selDistrict"></select>
								</li>
								<li>
									<label>Chọn phường</label> 
									<select name="selWard" id="selWard"></select>
								</li>
								<li>
									<label>Số nhà</label> 
									<input type="text" name="txtNumber" />
								</li>
								<li>
									<label>Đường</label> 
									<input type="text" name="txtStreet" />
								</li>
								<li>
									<label>Tên địa điểm</label> 
									<input type="text" name="txtProvider" />
								</li>
								<li>
									<label>&nbsp;</label> 
									<input type="submit" value="Tìm kiếm" />
								</li>
							</ul>
						</form>
						
						<form name="searchItem" action="index.php?view&type=advancedSearch&cat=item" method="post">
							<ul class="frm">
								<li>
									<label>Tên item</label> 
									<input type="text" name="txtItemName" />
								</li>
								<li>
									<label>Giá bắt đầu</label> 
									<input type="text" name="txtBeginPrice" />
								</li>
								<li>
									<label>Giá tối đa</label> 
									<input type="text" name="txtEndPrice" />
								</li>
								<li>
									<label>Đơn vị</label> 
									<input type="text" name="txtUnit" />
								</li>
								<li>
									<label>&nbsp;</label> 
									<input type="submit" value="Tìm kiếm" />
								</li>
							</ul>
						</form>
						<br />
						<div class="yd_rp_widget search_result">   
						<?php
                    		if (isset($ids) && $ids) {
                    			foreach ($ids as $id) {
                    	?>
                    				<div class="block_item">
                    					<a href="<?php echo $arrLink[$id]?>" title="<?php echo $arrText[$id]?>">
                    						<img src="<?php echo $imgs[$id]?>" class="smallObject" />
                    					</a>
                    					<p class="text_center">
                    						<a href="<?php echo $arrLink[$id]?>" title="<?php echo $arrText[$id]?>">
                    							<?php echo $arrText[$id]?>
                    						</a>	
                    					</p>
                    				</div>	
                    	<?php 
                    			}
                    		} 
                    	?>     
                    	</div>                                                          
                    </div>  <!--end section -->
            	</div> <!-- end left -->        
                <div class="right">
        			<div class="aside">
                        <ul class="blockRightSide">
                        	<h2 class="widgettitle">Đăng nhập</h2>	
                            <li class="blockRight" id="blockSignIn"></li>
                            
                            <h2 class="widgettitle">Tìm kiếm</h2>
                            <li class="blockRight" id="blockSearch"></li>
                            
                            <h2 class="widgettitle">Thành viên</h2>                                            
                            <li class="blockRight" id="blockMembers"></li>
                            
                            <h2 class="widgettitle">Bài đăng mới nhất</h2>
                            <li class="blockRight" id="blockNewestPosts"></li>                          
                        </ul>
                    </div>        
                </div> <!--end right-->
			</div> <!--end container-->		
            
            <div id="footer" class="footer clearfix"></div>            
		</div>
	</body>
</html>